package com.study.model.vo;

import java.math.BigDecimal;
import java.sql.Date;

import com.alibaba.fastjson.JSONObject;
import com.study.model.pojo.Orderdetail;
import com.study.util.Arith;

/**
 * 条目对象
 * 
 * @author msi-
 *
 */
public class Cart {

	Good goods = new Good();// 商品对象
	Orderdetail orderdetail = new Orderdetail();
	JSONObject json = new JSONObject();
	private Integer quatity;// 商品数量
	private double sum;// 总金额
	private String desc;// 备注

	public Cart() {
		super();
		// TODO Auto-generated constructor stub
	}



	public Cart(Good goods, Orderdetail orderdetail, JSONObject json, Integer quatity, double sum, String desc) {
		super();
		this.goods = goods;
		this.orderdetail = orderdetail;
		this.json = json;
		this.quatity = quatity;
		this.sum = sum;
		this.desc = desc;
	}



	public Orderdetail getOrderdetail() {
		return orderdetail;
	}

	public void setOrderdetail(Orderdetail orderdetail) {
		this.orderdetail = orderdetail;
	}



	@Override
	public String toString() {
		return "Cart [goods=" + goods + ", orderdetail=" + orderdetail + ", json=" + json + ", quatity=" + quatity
				+ ", sum=" + sum + ", desc=" + desc + "]";
	}

	public Good getGoods() {
		return goods;
	}

	public void setGoods(Good goods) {
		this.goods = goods;
	}

	public Integer getQuatity() {
		return quatity;
	}

	public void setQuatity(Integer quatity) {
		this.quatity = quatity;
	}

	public double getSum() {
		BigDecimal mul = Arith.mul(goods.getGooPrice(), this.quatity);
		double doubleValue = mul.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
		// System.out.println(doubleValue);
		return doubleValue;
	}

	public void setSum(double sum) {
		this.sum = sum;
	}

	public JSONObject getJson() {
		return json;
	}

	public void setJson(JSONObject json) {
		this.json = json;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	
	

}
